<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
	<title>参与记录</title>
	<link rel="stylesheet" type="text/css" href="https://at.alicdn.com/t/font_474420_uc06i8zic2z9f6r.css">
	<link rel="stylesheet" type="text/css" href="css/swiper.min.css">
	<link rel="stylesheet" type="text/css" href="css/style.css">
	<script type="text/javascript" src="js/fontSize.js"></script>
	<script type="text/javascript" src="js/layer/layer.js"></script>
	<script type="text/javascript" src="js/zepto.min.js"></script>
	<script type="text/javascript" src="js/swiper.min.js"></script>
	<script type="text/javascript" src="js/vue.js"></script>
	<script type="text/javascript" src="js/jweixin-1.2.0.js"></script>
	<script type="text/javascript" src="js/config.js"></script>
</head>
<body class="bgcolor index">
	<div id="app">
		<!-- <ul class="partTab">
			<li class="active"><span>全部</span></li>
			<li><span>进行中</span></li>
			<li><span>已结束</span></li>
		</ul> -->
		<div class="emptyAdress" v-if="list.length==0">暂没有参与记录哟</div>
		<ul class="partList">
			<ul>
				<li class="list" v-for="item in list" @click="goDetail(item.id)">
					<div class="img_div">
					   <img :src="item.url" alt="" class="list_img">
                       <span class="time">{{item.str}}</span>
	                   
					    <div class="icon_prises">
					          <!-- 参与 -->
					         <img src="img/p_59.png" class="icon_prise" v-if="item.before==1"/>  
					         <img src="img/p_22.png" class="icon_prise" v-if="item.answered==1&&item.can_answer==1&&item.isEnd==0" />  
					         <img src="img/p_23.png" class="icon_prise" v-if="item.before==0&&item.can_answer==0" />  
					          <!-- 参与 end-->
					    </div>    
					</div>
					<div class="list_desc">{{item.title}}</div>
					<div class="list_bottom">
				      <img  src="img/p_1.png" class="icon_img" />
				      <span class="zhunfa">{{item.count}}</span> 
				      <img  src="img/p_2.png" class="icon_img" />
				      <span class="comonts">{{item.commentCount}}</span>       
				    </div>
				</li>
			</ul>
			<!-- <li>
				<div class="partTop">
					<div class="partLeft">
						<span>
							<img src="img/p_58.png" alt="" class="partInImg">
						</span>
						<div class="partEnd">活动已结束</div>
					</div>
					<div class="partRight">
						<div class="partName">诺心巧克力慕斯奶油蛋糕/情侣定制产品</div>
						<div class="partTime">2017.11.15</div>
						<i class="iconfont icon-xiangyou"></i>
					</div>
				</div>
				<div class="partBottom borderTop">
					获得<span>全场9折奖励BUFF</span>
					<button type="button" class="gobuy">去购买</button>
				</div>
			</li>
			<li>
				<div class="partTop">
					<div class="partLeft">
						<span>
							<img src="img/p_58.png" alt="" class="partInImg">
						</span>
						<div class="partEnd">活动已结束</div>
					</div>
					<div class="partRight">
						<div class="partName">诺心巧克力慕斯奶油蛋糕/情侣定制产品</div>
						<div class="partTime">2017.11.15</div>
						<i class="iconfont icon-xiangyou"></i>
					</div>
				</div>
				<div class="partBottom borderTop">
					活动进行中，请耐心等待开奖
					<button type="button" class="gobuy disabled">去购买</button>
				</div>
			</li> -->
		</ul>
	</div>
	<script type="text/javascript">
		var app = new Vue({
			el: '#app',
			data: {
			    list:[],
		        unionid:GetQueryString("unionid"),
		        token:GetQueryString("token"),
		       
			},
			mounted(){
				this.getList();
				
			},
			methods:{
				getStr(res){
			    	var that=this;
			        that.now_mic_time=res.now_mic_time;
	                for (var i = 0; i < res.data.list.length; i++) {
	                  var time=getTime(res.data.list[i].begin_time_date);
	                  var time1=getTime(res.data.list[i].e_time_date);
	                  var time2=getTime(res.data.list[i].expire_date);
	                  if(res.now_mic_time<time){
	                     var phase=time-res.now_mic_time;
	                     res.data.list[i].str="距离开始："+getDay(phase)+"天"+getHour(phase)+"时"+getMiute(phase)+"分";
	                     res.data.list[i].before=1;
	                  }else if(time<res.now_mic_time&&res.now_mic_time<time1){
	                      var phase1=time1-res.now_mic_time;
	                      res.data.list[i].str="距离答题结束："+getDay(phase1)+"天"+getHour(phase1)+"时"+getMiute(phase1)+"分";
	                      res.data.list[i].before=0;

	                  }else if(res.now_mic_time>time1&&res.now_mic_time<time2){
	                      var phase2=time2-res.now_mic_time;
	                      res.data.list[i].before=0;
	                      res.data.list[i].str="距离活动结束："+getDay(phase2)+"天"+getHour(phase2)+"时"+getMiute(phase2)+"分";
	                  }else{
	                      res.data.list[i].before=0;
	                      res.data.list[i].str="竞猜时间："+res.data.list[i].begin_time_str+"-"+res.data.list[i].expire_str;
	                  }
	                } 
	              return res.data.list;

			    },
			    goDetail:function(id){
			        window.location.href="detail.html?id="+id+"&unionid="+this.unionid
			    },
				getList:function(from){
			        var that=this;
			        ajaxFun("POST","/get_question_recommend",{
			        	unionid:this.unionid,
			        	from:0,
                        length:40
			      	},function(data){
			            var res=data;
			            if(res.code==1){
			            	
			            	that.list=that.getStr(res);
			              
			            }else{
			            	showLayer(res.message);
			            }
                        
			        });
			    },
			}
		});
	</script>
</body>
</html>